package com.harry.resource.workflow.properties;

import java.util.Map;

import com.harry.basis.PropertySettings;
import com.harry.resource.workflow.entity.WorkFlowInstance;
import com.harry.utility.InnerUtils;
import com.harry.utility.query.InnerCriteria;

public class Ps4WorkFlowInstance extends PropertySettings<WorkFlowInstance> {

	@Override
	public String[] nameProperties() {
		return new String[] { "name" };
	}

	@Override
	public String[] keyProperties() {
		return new String[] { "name", "currentWorkStateInstance.name" };
	}

	@Override
	public String[] listProperties() {
		return new String[] { "name", "flowDefinition.name", "createTime" };
	}

	@Override
	public String[] editProperties() {
		return null;
	}

	@Override
	public String[] addProperties() {
		return new String[] { "name", "flowDefinition", "flowVariables" };
	}

	@Override
	public String[] criteriaProperties() {
		return null;
	}

	@Override
	public String[] listLabels() {
		return null;
	}

	@Override
	public Integer[] listIndexes() {
		return null;
	}

	@Override
	public String[] editLabels() {
		return null;
	}

	@Override
	public Integer[] editIndexes() {
		return null;
	}

	@Override
	public String[] addLabels() {
		return null;
	}

	@Override
	public Integer[] addIndexes() {
		return null;
	}

	@Override
	public String[] criteriaLabels() {
		return null;
	}

	@Override
	public Integer[] criteriaIndexes() {
		return null;
	}

	@Override
	public void permSettings(Map<String, Map<String, Object>> perm_map) {
		super.permSettings(perm_map);
		perm_map.put("post", InnerUtils.mapObject(// e
				"currentWorkStateInstance.flowInstance", "{{params}}", // e
				"currentWorkStateInstance.stateDefinition.id", InnerUtils.mapObject(null, null// e
						, "resourceName", "workFlowDefinition"// e
						, "action", "getlist"// e
						, "params", InnerUtils.mapObject("criteria", new InnerCriteria("eq", "id", "{{params.flowDefinition.id}}", null, "initialStateDefinition.id"))// e
						, "target", "list[0].values[0]"// e
				)// e
		));
	}
}
